package com.gserver.utils.resource;

import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;

import com.gserver.commons.resource.impl.AbstractExcelResource;

/**
 * 挖宝相关
 * 
 * @author
 * @param <V>
 * 
 */
public class DigLoader extends AbstractExcelResource {

	 public DigLoader(String file)
     {
          super(file);
          loadFromXls();
     }

     @Override
     public void loaderPage(HSSFSheet sheet, int page)
     {
          // 只读指定页
          if(page == 0)
          {
               for(int i = 1; i < sheet.getPhysicalNumberOfRows(); i++)
               {
                    HSSFRow row = sheet.getRow(i);
                    int index = 0;

                    Dig digGen = new Dig();

                    digGen.setId(getInt(row, index++));
                    digGen.setOpenLevel(getInt(row, index++));
                    digGen.setTime(getInt(row, index++));
                    digGen.setReward(getString(row, index++));
                    digGen.setQuality(getInt(row, index++));
//                    digGen.setType((byte)getInt(row, index++));
                    digGen.setExp(getInt(row, index++));
                    digGen.setIntegral(getInt(row, index++));
                    put(digGen.getId(), digGen);
                    putList(digGen.getId(), digGen);
//                    DigInfos.digInfos.put(digGen.getId(), new DigInfo(digGen));
               }
          }
     }
     
     @Override
     public void checkResource()
     {
          for(Dig titleGen : getList(Dig.class))
          {
               System.out.println(titleGen);
          }
     }
}
